add syntax_highlight.languages()#265
Merged
mhils merged 3 commits intomitmproxy:mainfrom May 30, 2025
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new Python API export for retrieving supported syntax highlighting languages while refactoring existing functions to use a new as_str() conversion.
- Updated syntax highlighting functions in mitmproxy-rs/src/syntax_highlight.rs to use as_str().
- Added a new languages() function and updated module exports in mitmproxy-rs/src/lib.rs.
- Modified the syntax_highlight getter in mitmproxy-rs/src/contentviews.rs to return a &'static str.
- Introduced a new VALUES array and as_str() method for Language in mitmproxy-highlight/src/lib.rs.
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| mitmproxy-rs/src/syntax_highlight.rs | Refactored tag conversion and added a new languages() function. |
| mitmproxy-rs/src/lib.rs | Updated module exports to include the new languages() function. |
| mitmproxy-rs/src/contentviews.rs | Changed syntax_highlight getter to return a static string reference. |
| mitmproxy-highlight/src/lib.rs | Added Language::VALUES and renamed to_str() to as_str() for Tag. |
Comments suppressed due to low confidence (1)
mitmproxy-rs/src/contentviews.rs:120
- Changing the return type from String to a static string reference may lead to lifetime or API compatibility issues. Ensure the underlying value is truly static or update dependent code accordingly.
pub fn syntax_highlight(&self) -> &'static str {
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.